var ECharts;
var zul;
var zj;
var sjk;
var zjj;
$(document).ready(function () {
    require.config({
        baseUrl: ctx + '/resource/plugins/echarts4',
        paths: {
            echarts: 'echarts',
            roma: 'theme/roma',
        }
    });
    require(
        [
            'echarts',
            'roma'
        ],
        function (ec) {
            ECharts = ec;
            queryYwInfo();//**业务对类别基本信息*/

            qyeryJkdYbp();//业务资源总数健康度

            qyeryZjPingYbp();//主机ping结果可用性

            qyerySjkYbp();//数据库状态可用性

            qyeryZjjYbp();//服务状态可用性

            qyeryZjJkdYbp();//主机健康度

            qyerySjkJkdYbp();//数据库健康度

            qyeryZjjJkdYbp();//中间件健康度

            host_cpu_top = ECharts.init(document.getElementById('host_cpu_top'), 'roma');//cpu
            queryCpuTop();

            host_nc_top = ECharts.init(document.getElementById('host_nc_top'), 'roma');//内存
            queryNcTop();

            host_cp_top = ECharts.init(document.getElementById('host_cp_top'), 'roma');//磁盘
            queryCpTop();

            database_hhs_top = ECharts.init(document.getElementById('database_hhs_top'), 'roma');//会话数量
            queryHhsTop();

            database_ssl_top = ECharts.init(document.getElementById('database_ssl_top'), 'roma');//锁数量
            querySslTop();

            database_qksjl_top = ECharts.init(document.getElementById('database_qksjl_top'), 'roma');//全库数据量
            queryQksjlTop();

            zjj_ttl_top = ECharts.init(document.getElementById('zjj_ttl_top'), 'roma');//吞吐率
            queryTulTop();

            zjj_dqdnc_top = ECharts.init(document.getElementById('zjj_dqdnc_top'), 'roma');//当前内存堆使用比率
            queryDqncdTop();
        }
    );
});

/**业务对类别基本信息*/
function queryYwInfo() {
    $.ajax({
        url: ctx + "/HostPage/queryResourceNumber",
        type: "post",
        data: {CI_TYPE: CI_TYPE},
        success: function (data) {
            var map = JSON.parse(data);
            var list = map.list;
            var list1 = map.list1;
            var tablel = "<span >" + "资源总数" + "</span>" +
                "<span class='yewu-headright'>" + list1[0].ZSL + "台" + "</span>";
            $("#yeinfo").append(tablel);

            if (list.length == 1) {
                var tablel1 = "<span >" + "主机总数" + "</span>" +
                    "<span class='yewu-headright'>" + list[0].YWDATA + "台" + "</span>";
                $("#yeinfo1").append(tablel1);

                var tablel2 = "<span >" + "数据库总数" + "</span>" +
                    "<span class='yewu-headright'>" + "暂无数据" + "</span>";
                $("#yeinfo2").append(tablel2);

                var tablel3 = "<span >" + "中间件总数" + "</span>" +
                    "<span  class='yewu-headright'>" + "暂无数据" + "</span>";
                $("#yeinfo3").append(tablel3);
            }
            if (list.length == 2) {
                var tablel1 = "<span >" + "主机总数" + "</span>" +
                    "<span class='yewu-headright'>" + list[0].YWDATA + "台" + "</span>";
                $("#yeinfo1").append(tablel1);

                var tablel2 = "<span >" + "数据库总数" + "</span>" +
                    "<span class='yewu-headright'>" + list[1].YWDATA + "台" + "</span>";
                $("#yeinfo2").append(tablel2);

                var tablel3 = "<span >" + "中间件总数" + "</span>" +
                    "<span class='yewu-headright'>" + "暂无数据" + "</span>";
                $("#yeinfo3").append(tablel3);
            }
            if (list.length == 3 || list.length == 6) {
                var tablel1 = "<span >" + "主机总数" + "</span>" +
                    "<span class='yewu-headright'>" + list[0].YWDATA + "台" + "</span>";
                $("#yeinfo1").append(tablel1);

                var tablel2 = "<span >" + "数据库总数" + "</span>" +
                    "<span class='yewu-headright'>" + list[1].YWDATA + "台" + "</span>";
                $("#yeinfo2").append(tablel2);

                var tablel3 = "<span >" + "中间件总数" + "</span>" +
                    "<span class='yewu-headright'>" + list[2].YWDATA + "台" + "</span>";
                $("#yeinfo3").append(tablel3);
            }
            zul = list1[0].ZSL;
            zj = list[0].YWDATA;
            sjk = list[1].YWDATA;
            zjj = list[2].YWDATA;
        },
        error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//业务资源总数健康度
function qyeryJkdYbp() {
    $.ajax({
        url: ctx + "/HostPage/queryJkd",
        type: "post",
        data: {CI_TYPE: CI_TYPE},
        success: function (data) {
            var cpuState = JSON.parse(data);
            var qq = "<div class='easy-pie-chart percentage' data-percent='' id='zsl' data-color='#87B87F'style='height: 75px; width: 75px; line-height: 74px; color: rgb(135, 184, 127);'>" +
                "<span class='percent' style='top:0px;left:20px;'>" + parseInt((zul - cpuState[0].EXT_UNIT_ID) / zul * 100) + "%" + "</span>" +
                "<canvas height='75' width='75'>" + "</canvas>" + "</div>" + "<h3 style='padding-left: 18px'>" + "健康度" + "</h3>";
            $("#zyzs_jkd").append(qq);
            $('#zsl').attr('data-percent', parseInt((zul - cpuState[0].EXT_UNIT_ID) / zul * 100));
            $('.easy-pie-chart.percentage').each(function () {
                $(this).easyPieChart({
                    barColor: $(this).data('color'),
                    trackColor: '#EEEEEE',
                    scaleColor: false,
                    lineCap: 'butt',
                    lineWidth: 8,
                    animate: ace.vars['old_ie'] ? false : 1000,
                    size: 75
                }).css('color', $(this).data('color'));
            });
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });

}

//主机ping结果可用性
function qyeryZjPingYbp() {
    $.ajax({
        url: ctx + "/HostPage/queryYbp",
        type: "post",
        data: {KPI_CODE: "PM-00-00-000-02"},
        success: function (data) {
            var cpuState = JSON.parse(data);
            var qq = "<div class='easy-pie-chart percentage' data-percent='' id='ping' data-color='#5eadf0'style='height: 75px; width: 75px; line-height: 74px; color: rgb(135, 184, 127);'>" +
                "<span class='percent' style='top:0px;left:25px;'>" + parseInt(cpuState[0].SUCCESS_VALUE / cpuState[0].COUNT_VALUE * 100) + "%" + "</span>" +
                "<canvas height='75' width='75'>" + "</canvas>" + "</div>" + "<h3 style='padding-left: 14px'>" + "可用性" + "</h3>";
            $("#zj_ping_kyx").append(qq);
            $('#ping').attr('data-percent', parseInt(cpuState[0].SUCCESS_VALUE / cpuState[0].COUNT_VALUE * 100));

            $('.easy-pie-chart.percentage').each(function () {
                $(this).easyPieChart({
                    barColor: $(this).data('color'),
                    trackColor: '#EEEEEE',
                    scaleColor: false,
                    lineCap: 'butt',
                    lineWidth: 8,
                    animate: ace.vars['old_ie'] ? false : 1000,
                    size: 75
                }).css('color', $(this).data('color'));
            });
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });

}

//数据库状态可用性
function qyerySjkYbp() {
    $.ajax({
        url: ctx + "/HostPage/queryYbp",
        type: "post",
        data: {KPI_CODE: "FM-00-03-001-01"},
        success: function (data) {
            var cpuState = JSON.parse(data);
            var qq = "<div class='easy-pie-chart percentage' data-percent='' id='sjkzt' data-color='#5eadf0'style='height: 75px; width: 75px; line-height: 74px; color: rgb(135, 184, 127);'>" +
                "<span class='percent' style='top:0px;left:25px;'>" + parseInt(cpuState[0].SUCCESS_VALUE / cpuState[0].COUNT_VALUE * 100) + "%" + "</span>" +
                "<canvas height='75' width='75'>" + "</canvas>" + "</div>" + "<h3 style='padding-left: 14px'>" + "可用性" + "</h3>";
            $("#sjk_zt_kyx").append(qq);
            $('#sjkzt').attr('data-percent', parseInt(cpuState[0].SUCCESS_VALUE / cpuState[0].COUNT_VALUE * 100));

            $('.easy-pie-chart.percentage').each(function () {
                $(this).easyPieChart({
                    barColor: $(this).data('color'),
                    trackColor: '#EEEEEE',
                    scaleColor: false,
                    lineCap: 'butt',
                    lineWidth: 8,
                    animate: ace.vars['old_ie'] ? false : 1000,
                    size: 75
                }).css('color', $(this).data('color'));
            });
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//中间件服务状态可用性
function qyeryZjjYbp() {
    $.ajax({
        url: ctx + "/HostPage/queryYbp",
        type: "post",
        data: {KPI_CODE: "FM-00-04-009-01"},
        success: function (data) {
            var cpuState = JSON.parse(data);
            var qq = "<div class='easy-pie-chart percentage' data-percent='' id='zjjzt' data-color='#5eadf0'style='height: 75px; width: 75px; line-height: 74px; color: rgb(135, 184, 127);'>" +
                "<span class='percent' style='top:0px;left:25px;'>" + parseInt(cpuState[0].SUCCESS_VALUE / cpuState[0].COUNT_VALUE * 100) + "%" + "</span>" +
                "<canvas height='75' width='75'>" + "</canvas>" + "</div>" + "<h3 style='padding-left: 14px'>" + "可用性" + "</h3>";
            $("#zjj_zt_kyx").append(qq);
            $('#zjjzt').attr('data-percent', parseInt(cpuState[0].SUCCESS_VALUE / cpuState[0].COUNT_VALUE * 100));

            $('.easy-pie-chart.percentage').each(function () {
                $(this).easyPieChart({
                    barColor: $(this).data('color'),
                    trackColor: '#EEEEEE',
                    scaleColor: false,
                    lineCap: 'butt',
                    lineWidth: 8,
                    animate: ace.vars['old_ie'] ? false : 1000,
                    size: 75
                }).css('color', $(this).data('color'));
            });
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//主机健康度
function qyeryZjJkdYbp() {
    $.ajax({
        url: ctx + "/HostPage/queryJkd",
        type: "post",
        data: {CI_TYPE: CI_TYPE},
        success: function (data) {
            var cpuState = JSON.parse(data);
            if (zj == undefined) {
                var qq = "<div class='easy-pie-chart percentage' data-percent='' id='' data-color='#87B87F'style='height: 75px; width: 75px; line-height: 74px; color: rgb(135, 184, 127);'>" +
                    "<span class='percent' style='top:0px;left:12px;'>" + "暂无数据" + "</span>" +
                    "<canvas height='75' width='75'>" + "</canvas>" + "</div>" + "<h3 style='padding-left: 18px'>" + "健康度" + "</h3>";
                $("#zj_jkd").append(qq);
            } else {
                var qq = "<div class='easy-pie-chart percentage' data-percent='' id='zjjkd' data-color='#87B87F'style='height: 75px; width: 75px; line-height: 74px; color: rgb(135, 184, 127);'>" +
                    "<span class='percent' style='top:0px;left:20px;'>" + parseInt((zj - cpuState[0].EXT_UNIT_ID) / zj * 100) + "%" + "</span>" +
                    "<canvas height='75' width='75'>" + "</canvas>" + "</div>" + "<h3 style='padding-left: 15px'>" + "健康度" + "</h3>";
                $("#zj_jkd").append(qq);
                $('#zjjkd').attr('data-percent', parseInt((zj - cpuState[0].EXT_UNIT_ID) / zj * 100));
            }
            $('.easy-pie-chart.percentage').each(function () {
                $(this).easyPieChart({
                    barColor: $(this).data('color'),
                    trackColor: '#EEEEEE',
                    scaleColor: false,
                    lineCap: 'butt',
                    lineWidth: 8,
                    animate: ace.vars['old_ie'] ? false : 1000,
                    size: 75
                }).css('color', $(this).data('color'));
            });
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });

}

//数据库健康度
function qyerySjkJkdYbp() {
    $.ajax({
        url: ctx + "/HostPage/queryJkd",
        type: "post",
        data: {CI_TYPE: CI_TYPE},
        success: function (data) {
            var cpuState = JSON.parse(data);
            if (sjk == undefined) {
                var qq = "<div class='easy-pie-chart percentage' data-percent='' id='' data-color='#87B87F'style='height: 75px; width: 75px; line-height: 74px; color: rgb(135, 184, 127);'>" +
                    "<span class='percent' style='top:0px;left:12px;'>" + "暂无数据" + "</span>" +
                    "<canvas height='75' width='75'>" + "</canvas>" + "</div>" + "<h3 style='padding-left: 18px'>" + "健康度" + "</h3>";
                $("#sjk_jkd").append(qq);
            } else {
                var qq = "<div class='easy-pie-chart percentage' data-percent='' id='sjkjkd' data-color='#87B87F'style='height: 75px; width: 75px; line-height: 74px; color: rgb(135, 184, 127);'>" +
                    "<span class='percent' style='top:0px;left:20px;'>" + parseInt((sjk - cpuState[0].EXT_UNIT_ID) / sjk * 100) + "%" + "</span>" +
                    "<canvas height='75' width='75'>" + "</canvas>" + "</div>" + "<h3 style='padding-left: 15px'>" + "健康度" + "</h3>";
                $("#sjk_jkd").append(qq);
                $('#sjkjkd').attr('data-percent', parseInt((sjk - cpuState[0].EXT_UNIT_ID) / sjk * 100));
            }
            $('.easy-pie-chart.percentage').each(function () {
                $(this).easyPieChart({
                    barColor: $(this).data('color'),
                    trackColor: '#EEEEEE',
                    scaleColor: false,
                    lineCap: 'butt',
                    lineWidth: 8,
                    animate: ace.vars['old_ie'] ? false : 1000,
                    size: 75
                }).css('color', $(this).data('color'));
            });
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });

}

//中间件健康度
function qyeryZjjJkdYbp() {
    $.ajax({
        url: ctx + "/HostPage/queryJkd",
        type: "post",
        data: {CI_TYPE: CI_TYPE},
        success: function (data) {
            var cpuState = JSON.parse(data);
            console.log(zjj);
            if (zjj == undefined) {
                var qq = "<div class='easy-pie-chart percentage' data-percent='' id='' data-color='#87B87F'style='height: 75px; width: 75px; line-height: 74px; color: rgb(135, 184, 127);'>" +
                    "<span class='percent' style='top:0px;left:12px;'>" + "暂无数据" + "</span>" +
                    "<canvas height='75' width='75'>" + "</canvas>" + "</div>" + "<h3 style='padding-left: 18px'>" + "健康度" + "</h3>";
                $("#zjj_jkd").append(qq);
            } else {
                var qq = "<div class='easy-pie-chart percentage' data-percent='' id='zjjjkd' data-color='#87B87F'style='height: 75px; width: 75px; line-height: 74px; color: rgb(135, 184, 127);'>" +
                    "<span class='percent' style='top:0px;left:20px;'>" + parseInt((zjj - cpuState[0].EXT_UNIT_ID) / zjj * 100) + "%" + "</span>" +
                    "<canvas height='75' width='75'>" + "</canvas>" + "</div>" + "<h3 style='padding-left: 15px'>" + "健康度" + "</h3>";
                $("#zjj_jkd").append(qq);
                $('#zjjjkd').attr('data-percent', parseInt((zjj - cpuState[0].EXT_UNIT_ID) / zjj * 100));
            }
            $('.easy-pie-chart.percentage').each(function () {
                $(this).easyPieChart({
                    barColor: $(this).data('color'),
                    trackColor: '#EEEEEE',
                    scaleColor: false,
                    lineCap: 'butt',
                    lineWidth: 8,
                    animate: ace.vars['old_ie'] ? false : 1000,
                    size: 75
                }).css('color', $(this).data('color'));
            });
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });

}

//CPUtop榜
//PM-00-01-001-05
function queryCpuTop() {
    $.ajax({
        url: ctx + "/HostPage/queryTop",
        type: "post",
        data: {KPI_CODE: "PM-00-01-001-05"},
        success: function (data) {
            var map = JSON.parse(data);
            var list = map.list;
            var xdata = [];
            var ydata = [];
            var x_value = [];
            for (var i = 0; i < list.length; i++) {
                x_value = list[i].IP_ADDR;
                xdata.push(x_value);
                ydata.push(list[i].AVG_VALUE);
            }
            option = {
                color: ['#3398DB'],
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                        type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                legend: {
                    formatter: function (series) {
                        return series;
                    },
                    textStyle: {
                        color: '#AAAAAA'
                    }
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: [
                    {
                        type: 'category',
                        // data: [1, 12, 23, 3,],
                        data: xdata,
                        axisTick: {
                            alignWithLabel: true
                        },
                        axisLabel: {
                            interval: 0,
                            rotate: 45,
                            margin: 8
                        }
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        // max: 100,
                        splitLine: {
                            show: true,
                        },
                        nameTextStyle: {
                            color: '#000000',
                        },
                        axisLabel: {
                            formatter: '{value} ',
                            textStyle: {
                                color: '#000000'
                            }
                        }
                    },
                ],
                series: [
                    {
                        name: 'CPU使用率',
                        type: 'bar',
                        barWidth: '60%',
                        // color: '#3398DB',
                        itemStyle: {
                            normal: {
                                color: new ECharts.graphic.LinearGradient(
                                    0, 0, 0, 1,
                                    [
                                        {offset: 0, color: '#acc7f6'},
                                        {offset: 0.5, color: '#5eadf0'},
                                        {offset: 1, color: '#3621f0'}
                                    ]
                                )
                            },
                        },
                        data: ydata,
                    }
                ]
            };
            host_cpu_top.setOption(option);
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//内存top榜
function queryNcTop() {
    $.ajax({
        url: ctx + "/HostPage/queryTop",
        type: "post",
        data: {KPI_CODE: "PM-00-01-002-01"},
        success: function (data) {
            var map = JSON.parse(data);
            var list = map.list;
            var xdata = [];
            var ydata = [];
            var x_value = [];
            for (var i = 0; i < list.length; i++) {
                x_value = list[i].IP_ADDR;
                xdata.push(x_value);
                ydata.push(list[i].AVG_VALUE);
            }
            option = {
                color: ['#3398DB'],
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                        type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                legend: {
                    formatter: function (series) {
                        return series;
                    },
                    textStyle: {
                        color: '#AAAAAA'
                    }
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: [
                    {
                        type: 'category',
                        // data: [1, 12, 23, 3,],
                        data: xdata,
                        axisTick: {
                            alignWithLabel: true
                        },
                        axisLabel: {
                            interval: 0,
                            rotate: 45,
                            margin: 8
                        }
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        // max: 100,
                        splitLine: {
                            show: true,
                        },
                        nameTextStyle: {
                            color: '#000000',
                        },
                        axisLabel: {
                            formatter: '{value} ',
                            textStyle: {
                                color: '#000000'
                            }
                        }
                    },
                ],
                series: [
                    {
                        name: '物理内存使用率',
                        type: 'bar',
                        barWidth: '60%',
                        // color: '#3398DB',
                        itemStyle: {
                            normal: {
                                color: new ECharts.graphic.LinearGradient(
                                    0, 0, 0, 1,
                                    [
                                        {offset: 0, color: '#acc7f6'},
                                        {offset: 0.5, color: '#5eadf0'},
                                        {offset: 1, color: '#3621f0'}
                                    ]
                                )
                            },
                        },
                        data: ydata,
                    }
                ]
            };
            host_nc_top.setOption(option);
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//磁盘top榜
function queryCpTop() {
    $.ajax({
        url: ctx + "/HostPage/queryTop",
        type: "post",
        data: {KPI_CODE: "PM-00-01-004-01"},
        success: function (data) {
            var map = JSON.parse(data);
            var list = map.list;
            var xdata = [];
            var ydata = [];
            var x_value = [];
            for (var i = 0; i < list.length; i++) {
                x_value = list[i].IP_ADDR;
                xdata.push(x_value);
                ydata.push(list[i].AVG_VALUE);
            }
            option = {
                color: ['#3398DB'],
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                        type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                legend: {
                    formatter: function (series) {
                        return series;
                    },
                    textStyle: {
                        color: '#AAAAAA'
                    }
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: [
                    {
                        type: 'category',
                        // data: [1, 12, 23, 3,],
                        data: xdata,
                        axisTick: {
                            alignWithLabel: true
                        },
                        axisLabel: {
                            interval: 0,
                            rotate: 45,
                            margin: 8
                        }
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        // max: 100,
                        splitLine: {
                            show: true,
                        },
                        nameTextStyle: {
                            color: '#000000',
                        },
                        axisLabel: {
                            formatter: '{value} ',
                            textStyle: {
                                color: '#000000'
                            }
                        }
                    },
                ],
                series: [
                    {
                        name: '磁盘总使用率',
                        type: 'bar',
                        barWidth: '60%',
                        // color: '#3398DB',
                        itemStyle: {
                            normal: {
                                color: new ECharts.graphic.LinearGradient(
                                    0, 0, 0, 1,
                                    [
                                        {offset: 0, color: '#acc7f6'},
                                        {offset: 0.5, color: '#5eadf0'},
                                        {offset: 1, color: '#3621f0'}
                                    ]
                                )
                            },
                        },
                        data: ydata
                    }
                ]
            };
            host_cp_top.setOption(option);
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//会话数量top榜
//PM-00-01-001-05
function queryHhsTop() {
    $.ajax({
        url: ctx + "/HostPage/queryTop",
        type: "post",
        data: {KPI_CODE: "PM-00-03-009-03"},
        success: function (data) {
            var map = JSON.parse(data);
            var list = map.list;
            var xdata = [];
            var ydata = [];
            var x_value = [];
            for (var i = 0; i < list.length; i++) {
                x_value = list[i].IP_ADDR;
                xdata.push(x_value);
                ydata.push(list[i].AVG_VALUE);
            }
            option = {
                color: ['#3398DB'],
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                        type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                legend: {
                    formatter: function (series) {
                        return series;
                    },
                    textStyle: {
                        color: '#AAAAAA'
                    }
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: [
                    {
                        type: 'category',
                        // data: [1, 12, 23, 3,],
                        data: xdata,
                        axisTick: {
                            alignWithLabel: true
                        },
                        axisLabel: {
                            interval: 0,
                            rotate: 45,
                            margin: 8
                        }
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        // max: 100,
                        splitLine: {
                            show: true,
                        },
                        nameTextStyle: {
                            color: '#000000',
                        },
                        axisLabel: {
                            formatter: '{value} ',
                            textStyle: {
                                color: '#000000'
                            }
                        }
                    },
                ],
                series: [
                    {
                        name: '会话数量',
                        type: 'bar',
                        barWidth: '60%',
                        // color: '#3398DB',
                        itemStyle: {
                            normal: {
                                color: new ECharts.graphic.LinearGradient(
                                    0, 0, 0, 1,
                                    [
                                        {offset: 0, color: '#acc7f6'},
                                        {offset: 0.5, color: '#5eadf0'},
                                        {offset: 1, color: '#3621f0'}
                                    ]
                                )
                            },
                        },
                        data: ydata,
                    }
                ]
            };
            database_hhs_top.setOption(option);
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//锁数量top榜
function querySslTop() {
    $.ajax({
        url: ctx + "/HostPage/queryTop",
        type: "post",
        data: {KPI_CODE: "PM-00-03-008-01"},
        success: function (data) {
            var map = JSON.parse(data);
            var list = map.list;
            var xdata = [];
            var ydata = [];
            var x_value = [];
            for (var i = 0; i < list.length; i++) {
                x_value = list[i].IP_ADDR;
                xdata.push(x_value);
                ydata.push(list[i].AVG_VALUE);
            }
            option = {
                color: ['#3398DB'],
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                        type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                legend: {
                    formatter: function (series) {
                        return series;
                    },
                    textStyle: {
                        color: '#AAAAAA'
                    }
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: [
                    {
                        type: 'category',
                        // data: [1, 12, 23, 3,],
                        data: xdata,
                        axisTick: {
                            alignWithLabel: true
                        },
                        axisLabel: {
                            interval: 0,
                            rotate: 45,
                            margin: 8
                        }
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        // max: 100,
                        splitLine: {
                            show: true,
                        },
                        nameTextStyle: {
                            color: '#000000',
                        },
                        axisLabel: {
                            formatter: '{value} ',
                            textStyle: {
                                color: '#000000'
                            }
                        }
                    },
                ],
                series: [
                    {
                        name: '锁数量',
                        type: 'bar',
                        barWidth: '60%',
                        // color: '#3398DB',
                        itemStyle: {
                            normal: {
                                color: new ECharts.graphic.LinearGradient(
                                    0, 0, 0, 1,
                                    [
                                        {offset: 0, color: '#acc7f6'},
                                        {offset: 0.5, color: '#5eadf0'},
                                        {offset: 1, color: '#3621f0'}
                                    ]
                                )
                            },
                        },
                        data: ydata,
                    }
                ]
            };
            database_ssl_top.setOption(option);
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//全库数据量top榜
function queryQksjlTop() {
    $.ajax({
        url: ctx + "/HostPage/queryTop",
        type: "post",
        data: {KPI_CODE: "PM-00-03-009-12"},
        success: function (data) {
            var map = JSON.parse(data);
            var list = map.list;
            var xdata = [];
            var ydata = [];
            var x_value = [];
            for (var i = 0; i < list.length; i++) {
                x_value = list[i].IP_ADDR;
                xdata.push(x_value);
                ydata.push(list[i].AVG_VALUE);
            }
            option = {
                color: ['#3398DB'],
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                        type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                legend: {
                    formatter: function (series) {
                        return series;
                    },
                    textStyle: {
                        color: '#AAAAAA'
                    }
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: [
                    {
                        type: 'category',
                        // data: [1, 12, 23, 3,],
                        data: xdata,
                        axisTick: {
                            alignWithLabel: true
                        },
                        axisLabel: {
                            interval: 0,
                            rotate: 45,
                            margin: 8
                        }
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        // max: 100,
                        splitLine: {
                            show: true,
                        },
                        nameTextStyle: {
                            color: '#000000',
                        },
                        axisLabel: {
                            formatter: '{value} ',
                            textStyle: {
                                color: '#000000'
                            }
                        }
                    },
                ],
                series: [
                    {
                        name: '全库数据量',
                        type: 'bar',
                        barWidth: '60%',
                        // color: '#3398DB',
                        itemStyle: {
                            normal: {
                                color: new ECharts.graphic.LinearGradient(
                                    0, 0, 0, 1,
                                    [
                                        {offset: 0, color: '#acc7f6'},
                                        {offset: 0.5, color: '#5eadf0'},
                                        {offset: 1, color: '#3621f0'}
                                    ]
                                )
                            },
                        },
                        data: ydata
                    }
                ]
            };
            database_qksjl_top.setOption(option);
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//吞吐率top榜
//PM-00-01-001-05
function queryTulTop() {
    $.ajax({
        url: ctx + "/HostPage/queryTop",
        type: "post",
        data: {KPI_CODE: "PM-00-05-009-31"},
        success: function (data) {
            var map = JSON.parse(data);
            var list = map.list;
            var xdata = [];
            var ydata = [];
            var x_value = [];
            for (var i = 0; i < list.length; i++) {
                x_value = list[i].IP_ADDR;
                xdata.push(x_value);
                ydata.push(list[i].AVG_VALUE);
            }
            option = {
                color: ['#3398DB'],
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                        type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                legend: {
                    formatter: function (series) {
                        return series;
                    },
                    textStyle: {
                        color: '#AAAAAA'
                    }
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: [
                    {
                        type: 'category',
                        // data: [1, 12, 23, 3,],
                        data: xdata,
                        axisTick: {
                            alignWithLabel: true
                        },
                        axisLabel: {
                            interval: 0,
                            rotate: 45,
                            margin: 8
                        }
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        // max: 100,
                        splitLine: {
                            show: true,
                        },
                        nameTextStyle: {
                            color: '#000000',
                        },
                        axisLabel: {
                            formatter: '{value} ',
                            textStyle: {
                                color: '#000000'
                            }
                        }
                    },
                ],
                series: [
                    {
                        name: '吞吐率',
                        type: 'bar',
                        barWidth: '60%',
                        // color: '#3398DB',
                        itemStyle: {
                            normal: {
                                color: new ECharts.graphic.LinearGradient(
                                    0, 0, 0, 1,
                                    [
                                        {offset: 0, color: '#acc7f6'},
                                        {offset: 0.5, color: '#5eadf0'},
                                        {offset: 1, color: '#3621f0'}
                                    ]
                                )
                            },
                        },
                        data: ydata,
                    }
                ]
            };
            zjj_ttl_top.setOption(option);
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}

//当前内存堆使用比率top榜
function queryDqncdTop() {
    $.ajax({
        url: ctx + "/HostPage/queryTop",
        type: "post",
        data: {KPI_CODE: "PM-00-04-003-01"},
        success: function (data) {
            var map = JSON.parse(data);
            var list = map.list;
            var xdata = [];
            var ydata = [];
            var x_value = [];
            for (var i = 0; i < list.length; i++) {
                x_value = list[i].IP_ADDR;
                xdata.push(x_value);
                ydata.push(list[i].AVG_VALUE);
            }
            option = {
                color: ['#3398DB'],
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                        type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                    }
                },
                legend: {
                    formatter: function (series) {
                        return series;
                    },
                    textStyle: {
                        color: '#AAAAAA'
                    }
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                xAxis: [
                    {
                        type: 'category',
                        // data: [1, 12, 23, 3,],
                        data: xdata,
                        axisTick: {
                            alignWithLabel: true
                        },
                        axisLabel: {
                            interval: 0,
                            rotate: 45,
                            margin: 8
                        }
                    }
                ],
                yAxis: [
                    {
                        type: 'value',
                        // max: 100,
                        splitLine: {
                            show: true,
                        },
                        nameTextStyle: {
                            color: '#000000',
                        },
                        axisLabel: {
                            formatter: '{value} ',
                            textStyle: {
                                color: '#000000'
                            }
                        }
                    },
                ],
                series: [
                    {
                        name: '当前内存堆使用比率',
                        type: 'bar',
                        barWidth: '60%',
                        // color: '#3398DB',
                        itemStyle: {
                            normal: {
                                color: new ECharts.graphic.LinearGradient(
                                    0, 0, 0, 1,
                                    [
                                        {offset: 0, color: '#acc7f6'},
                                        {offset: 0.5, color: '#5eadf0'},
                                        {offset: 1, color: '#3621f0'}
                                    ]
                                )
                            },
                        },
                        data: ydata,
                    }
                ]
            };
            zjj_dqdnc_top.setOption(option);
        }, error: function (textStatus) {
            console.log("error:" + textStatus.status);
        }
    });
}